package com.example.democrud.employee.pojo;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.Version;
import com.example.democrud.enums.SexEnum;
import com.example.democrud.group.Insert;
import com.example.democrud.group.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.hibernate.validator.constraints.Range;
import org.springframework.beans.factory.annotation.Qualifier;

import javax.validation.constraints.*;
import java.time.LocalDateTime;

/**
 * @ClassName EmployeeDTO
 * @Author Administrator
 * @Date 2020/4/22   17:02
 */
@Data
@ApiModel("员工新增请求对象")
public class EmployeeDTO {

    @ApiModelProperty(value = "员工id" ,notes = "mybatis-plus自动生成")
    @NotNull(message = "id不能为空 ",groups = Update.class)
    @ExcelProperty("员工ID")
    private Long employeeId;

    @NotBlank(message = "姓名不能为空" ,groups = Insert.class)
    @ApiModelProperty(value = "姓名")
    @ExcelProperty("员工姓名")
    private String name;

    @ApiModelProperty(value = "性别")
    @ExcelProperty("员工性别")
    private SexEnum sex;

    @Range(min = 0l,max = 60l,message ="年龄不能小于18岁 大于60岁",groups = {Insert.class,Update.class} )
    @ApiModelProperty(value = "年龄",notes = "age>0")
    @ExcelProperty("员工年龄")
    private Integer age;

    @ApiModelProperty(value = "邮箱")
    @ExcelProperty("员工邮箱")
    private String email;

    @ApiModelProperty(value = "上级id",notes = "无上级则为0")
    @Min(value = 0,message = "id>=0" , groups = {Insert.class,Update.class})
    @ExcelProperty("员工上级")
    private Long managerId;

    @ApiModelProperty(value = "乐观锁",notes = "default 1")
    @ExcelIgnore
    private Integer version;

}
